# -*- coding: utf-8 -*-
# @Time    : 2024/8/30 下午1:44
# @Author  : liujun
# @Email   : 2592730854@qq.com
# @File    : source_pool_page.py
# @Software: PyCharm

from selenium.webdriver.common.by import By
from pages.base_page import BasePage
from selenium.webdriver.support.select import Select

class SourcePoolPage(BasePage):
    """线索池"""
    # 线索池按钮
    url="/crm/index.php?m=leads&a=index&by=public"
    source_pool_btn_locator=(By.CSS_SELECTOR,"body > div.container > div.page-header > ul > li:nth-child(2) > a")
    source_pool_dispense_locator = (By.LINK_TEXT, "分配")  # 分配
    # 分配弹框确定（OK）按钮
    source_pool_dispense_ok_locator = (By.CSS_SELECTOR,
                                       "body > div:nth-child(11) > div.ui-dialog-buttonpane.ui-widget-content.ui-helper-clearfix > div > button:nth-child(1) > span")
    source_pool_get_locator = (By.LINK_TEXT, "领取")  # 线索池领取

    def click_source_pool_btn(self):
        """点击线索池"""
        self.driver.find_element(*self.source_pool_btn_locator).click()
    def click_source_pool_dispense(self):
        """点击分配"""
        self.driver.find_element(*self.source_pool_dispense_locator).click()
    def click_source_pool_dispense_ok(self):
        """点击OK"""
        self.driver.find_element(*self.source_pool_dispense_ok_locator).click()
    def click_source_pool_get(self):
        """点击分配"""
        self.driver.find_element(*self.source_pool_get_locator).click()
    def accept(self):
        """确定弹框"""
        self.driver.switch_to.alert.accept()